export const fetchToken = data => fetch(`${APP_CONFIG.oauthEndPoint}/api/oauth/token`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
  },
  body: data,
}).then(res => res.json())
  .then(res => [res.access_token, res.expires_in]);

export const me = token => Hfetch.get(`${APP_CONFIG.oauthEndPoint}/api/account/queryprofile`, {}, {
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

export const signout = token => Hfetch.del(`${APP_CONFIG.oauthEndPoint}/api/oauth/token?access_token=${token}`);
